package com.woniu.supermarket.web;

import com.woniu.supermarket.entity.PurchaseCheck;
import com.woniu.supermarket.entity.WarehousingCheck;
import com.woniu.supermarket.result.ResultResponse;
import com.woniu.supermarket.service.IPurchaseCheckService;
import com.woniu.supermarket.service.IWarehousingCheckService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("warehousingcheck")
public class WarehousingCheckController {
    @Autowired
    IWarehousingCheckService warehousingCheckService;


    @GetMapping("/findWarehousingCheckByWarehousingNumber/{warehousingNumber}")
    @ApiOperation(value = "查询审核信息操作")
        public ResultResponse<List<WarehousingCheck>> findWarehousingCheckByWarehousingNumber(@ApiParam(name="warehousingNumber",value = "入库单编号")@PathVariable(name = "warehousingNumber") String warehousingNumber){
        ResultResponse<List<WarehousingCheck>> result = null;
        try {
            List<WarehousingCheck> list = warehousingCheckService.queryOneByWarehousingNumber(warehousingNumber);
            if(list != null){
                result = new ResultResponse<>(200,"查询审核信息成功",list);
            }else {
                result = new ResultResponse<>(201,"查询审核信息失败");
            }
        }catch (RuntimeException e){
            e.printStackTrace();
            result = new ResultResponse<>(201,"系统错误");
        }
        return result;
    }

}
